<script type="text/javascript"><!--//--><![CDATA[//><!--

 	$(document).ready(function() {
		// Setup Form
		$('#form_master').setupForm([
			{ name: 'no_tagihan_listrik', type: 'text', size: 'short', maxlength: 10, noempty:true },
				{ name: 'nama_tenant', type: 'lov', size: 'long',
				onClearButton:function(){
					$(this).setval(''); 
					$('#no_tenant').setval(''); 
					$('#no_tenant').setval('');
				},
				onActionButton:function(){ 
					LOVTenant({ onSelect:function(row){ 
						$('#nama_tenant').setval(row.nama_tenant); 
						$('#no_tenant').setval(row.no_tenant); 
					} }); 
				}
			},
			{ name: 'nama_cabang', type: 'text', size: 'short', maxlength: 10, noempty:true },
			{ name: 'no_permintaan', type: 'text', size: 'long', maxlength: 255},
			{ name: 'petugas', type: 'text', size: 'long', maxlength: 255},
			{ name: 'status_toko', type: 'text', size: 'long', maxlength: 255},
			{ name: 'tanggal', type: 'date', size: 'short', maxlength: 20 }
		], <?php echo json_encode($data); ?>);
        
		
        <?php if($mode=="edit"){ ?>
        $('#no_tagihan_listrik').readonly();
        <?php } ?>
		
		// Set Action Button
		var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
							$('#form_master').submitForm(	'/'+controller+'/ajax_post', 
							{ detail:[	{ table: 'dtl_sample2', field:['no_detail_tagihan','tanggal_pembayaran','nama_tenant','no_tenant','biaya_tagihan','keterangan']}], 
							onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/edit/?no_tagihan_listrik='+(oData.genid!='' ? oData.genid : $('#no_tagihan_listrik').getval())); }
															} 
														); 
						}},
					   { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
		setAction(buttons);
		
		// Create Tab
		$('#tt').tabs({ border:false });  
		
		// Focus at First Object
		$('#form_master').focusFirst();

		
    });




//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>
    <table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">
    <tr>
        <td class="label" style="width:150px">Nama Cabang</td>
        <td><select id="nama_cabang" name="opsi">
				<option value="Ada"></option>
				<option value="Tidak Tahu">Cabang 2</option>
				<option value="Sebagian">Cabang 3</option>
			</select></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">No Permintaan</td>
        <td ><input id="no_permintaan" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Petugas</td>
        <td><select id="petugas" name="opsi">
				<option value="Ada"></option>
				<option value="Tidak Tahu">Cabang 2</option>
				<option value="Sebagian">Cabang 3</option>
			</select></td>
    </tr>     
    <tr>
        <td class="label" style="width:150px">Status Toko</td>
        <td><select id="status_toko" name="opsi">
				<option value="Ada"></option>
				<option value="Tidak Tahu">Cabang 2</option>
				<option value="Sebagian">Cabang 3</option>
			</select></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Tanggal</td>
        <td ><input id="tanggal" /></td>
    </tr>    
    </table>
    <div id="tt" class="easyui-tabs" style="min-height:400px;">  
	    <div title="Detail Tagihan" style="overflow:auto;padding:10px;">  
	    	<?php require_once('formdtl.php'); ?>
	    </div>	
	</div>
